<?php
define('IN_SHOP', 1);

$root_path = './';
include($root_path.'common.php');
$mail = request_var('mail','');
$user->session_begin($mail ? false : true);
$user->setup('home');

send_mail();

$type = request_var('type','');
$id = request_var('id',0);
$smarty->assign('id',$id);
if($_SESSION['session_admin']){	
	include($root_path.'includes/admin_func.php');
	$admin = new Admin();
	$admin->assign();	
	
	$del = request_var('id_del',0);
	$edit = request_var('edit_id',0);		
	$del_photo = request_var('del_photo',0);
	$new_photo = request_var('new_photo',0);
	if($del){
		$admin->delete($del);		
	}
	if($edit){		
		$admin->edit();	
		redirect("detail.php?id=$edit");		
	}
	if($del_photo){
		$admin->delete($del_photo,'obrazky');
		redirect("detail.php?id=$id");	
		
	}
	if($new_photo){
		$admin->add_photo($id);
		redirect("detail.php?id=$id");	
		
	}
	
}
//$send	= request_var('send', false);
//$email	= request_var('email', '');

$detail = array(
  'vyrobce' => $znacka,
  'popis' => $popis,
);

if($edit){
	$id = $edit;	
}

$ph = new Item(TBL_OBRAZKY);
$ph->addwhere(array('id_auta'=>(int)$id ));
$ph->init(" * ",false);
//$ph->search();
$ph->assign('photo'); 


$item = new Item(TBL_AUTA);
$item->addwhere(array('id'=>(int)$id ));
$item->init();
//$item->search();
$item->assign();



//print_r($_GET);
;
$smarty->assign('desc',$item->getDesc());
$smarty->assign('page','Detail vozidla');

get_code('kontakt');
page_header($item->getTitle());
$file_output =   "detail.html";

$smarty->display($file_output);


?>